import req from "@/uni-sdk/request/request.js";
export const Api = {
	storedList: "mall-ums/app-api/v1/member/stored-values/list",
	storedBalance: "mall-ums/app-api/v1/member/stored-values/balance",
	bindStored: "mall-ums/app-api/v1/member/stored-values/binding",

	orderPage: "mall-ums/app-api/v1/goods-orders/page",
	orderDetail: "mall-ums/app-api/v1/goods-orders/order",

	createOrder: "mall-ums/app-api/v1/goods-orders/create-order",
	payInfo: "mall-ums/app-api/v1/goods-orders/pay-info",
};

export function getOrderPage(data) {
	return req.commonGet(Api.orderPage, data, true);
}

export function getOrderDetail(orderNo, loading) {
	return req.commonGet(Api.orderDetail, {
		orderNo
	}, loading);
}

export function createOrder(data) {
	return req.commonPost(Api.createOrder, data, true);
}

export function getPayInfo(orderNo) {
	return req.commonPost(Api.payInfo, {
		orderNo
	}, true);
}

export function getStoredBalance() {
	return req.commonGet(Api.storedBalance, {}, false);
}

export function getStoredList() {
	return req.commonGet(Api.storedList, {}, true);
}

export function bindStored(data) {
	return req.put({
		url: Api.bindStored,
		data
	}, {
		useGlobalLoading: true
	});
}